package com.ruoyi.service.basic.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.domain.basic.MesBomDetail;
import com.ruoyi.mapper.basic.MesBomDetailMapper;
import com.ruoyi.service.basic.IMesBomDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * BOM明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-01-01
 */
@Service
public class MesBomDetailServiceImpl implements IMesBomDetailService 
{
    @Autowired
    private MesBomDetailMapper mesBomDetailMapper;

    /**
     * 查询BOM明细
     * 
     * @param detailId BOM明细主键
     * @return BOM明细
     */
    @Override
    public MesBomDetail selectMesBomDetailByDetailId(Long detailId)
    {
        return mesBomDetailMapper.selectMesBomDetailByDetailId(detailId);
    }

    /**
     * 查询BOM明细列表
     * 
     * @param mesBomDetail BOM明细
     * @return BOM明细
     */
    @Override
    public List<MesBomDetail> selectMesBomDetailList(MesBomDetail mesBomDetail)
    {
        return mesBomDetailMapper.selectMesBomDetailList(mesBomDetail);
    }

    /**
     * 新增BOM明细
     * 
     * @param mesBomDetail BOM明细
     * @return 结果
     */
    @Override
    public int insertMesBomDetail(MesBomDetail mesBomDetail)
    {
        mesBomDetail.setCreateTime(DateUtils.getNowDate());
        return mesBomDetailMapper.insertMesBomDetail(mesBomDetail);
    }

    /**
     * 修改BOM明细
     * 
     * @param mesBomDetail BOM明细
     * @return 结果
     */
    @Override
    public int updateMesBomDetail(MesBomDetail mesBomDetail)
    {
        mesBomDetail.setUpdateTime(DateUtils.getNowDate());
        return mesBomDetailMapper.updateMesBomDetail(mesBomDetail);
    }

    /**
     * 批量删除BOM明细
     * 
     * @param detailIds 需要删除的BOM明细主键
     * @return 结果
     */
    @Override
    public int deleteMesBomDetailByDetailIds(Long[] detailIds)
    {
        return mesBomDetailMapper.deleteMesBomDetailByDetailIds(detailIds);
    }

    /**
     * 删除BOM明细信息
     * 
     * @param detailId BOM明细主键
     * @return 结果
     */
    @Override
    public int deleteMesBomDetailByDetailId(Long detailId)
    {
        return mesBomDetailMapper.deleteMesBomDetailByDetailId(detailId);
    }

    /**
     * 根据BOM ID查询明细列表
     * 
     * @param bomId BOM ID
     * @return BOM明细列表
     */
    @Override
    public List<MesBomDetail> selectMesBomDetailByBomId(Long bomId)
    {
        return mesBomDetailMapper.selectMesBomDetailByBomId(bomId);
    }

    /**
     * 根据BOM ID删除明细
     * 
     * @param bomId BOM ID
     * @return 结果
     */
    @Override
    public int deleteMesBomDetailByBomId(Long bomId)
    {
        return mesBomDetailMapper.deleteMesBomDetailByBomId(bomId);
    }

    /**
     * 批量新增BOM明细
     * 
     * @param mesBomDetailList BOM明细列表
     * @return 结果
     */
    @Override
    public int batchInsertMesBomDetail(List<MesBomDetail> mesBomDetailList)
    {
        return mesBomDetailMapper.batchInsertMesBomDetail(mesBomDetailList);
    }
}